/**
 * 数值转为1000K=1M/G/T
 */
function numFormat(num = 0,defaultVal = false) {
	var mark = '';
    if(!num && !(defaultVal === false)){
        return defaultVal;
    }
	switch (true) {
		case num < 1000:
			break;
		case num < 1000000:
			num = parseInt(num/1000);
			mark = 'K';
			break;
		case num < 1000000000:
			num = parseInt(num/1000000);
			mark = 'M';
			break;
		case num < 1000000000000:
			num = parseInt(num/1000000000);
			mark = 'G';
			break;
		case num < 1000000000000000:
			num = parseInt(num/1000000000000);
			mark = 'T';
			break;
		default:
			num = '';
			mark = '∞';
	}
	return num + mark;
}

export default numFormat;
